import 'package:flutter/cupertino.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:scanner/config/wj_color.dart';


class WJProgressWidget extends StatelessWidget {
  final Color? color;

  const WJProgressWidget({super.key, this.color});

  @override
  Widget build(BuildContext context) {
    return Center(child: CupertinoActivityIndicator(color: color ?? WJColor.appColor));
  }
}

class UIUtils {
  static void showSuccessWithCustomDelay(String str) {
    EasyLoading.showSuccess(str);
    const customDelay = Duration(seconds: 1);
    Future.delayed(customDelay, () {
      EasyLoading.dismiss();
    });
  }

  static void showErrorWithCustomDelay(String str) {
    EasyLoading.showError(str);
    const customDelay = Duration(seconds: 1);
    Future.delayed(customDelay, () {
      EasyLoading.dismiss();
    });
  }
}
